home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Perl Multimedia Cyber Classroom
/
PERL Multimedia Cyber Classroom (Prentice Hall)(1998).ISO
/
perlbyex
/
code.jar
/
10ex003.jar
/
code
/
ch10
/
10ex003
/
10ex003.pl
next >
Wrap
Perl Script
|
1998-04-01
|
623b
|
20 lines
#!/usr/bin/perl
# Default package is main
use strict 'vars'; # makes sure that global or local variables are outlawed
my @town = ( "Boston" , "Chico" , "Tampa" );
my $friend= "Mary" ;
print " In main: \$friend is $friend
" ;
{package boy; # package declaration
my $friend= "Lizzy" ;
print "In boy \$friend is $friend\n" ;
print "In boy \$main::friend is unknown " , $main::friend, "\n" ;
print "In boy \@::town is unknown " , @::town, "\n" ;
}
#back in package main
print "1.In main: \$boy::friend is $boy::friend.\n" ;
print "2.In main: \@town is " , join(", ", @town), " .\n" ;